//
//  DiscoverItemCell.m
//  TerritoryShopkeeper
//
//  Created by xiaowu on 2017/12/8.
//  Copyright © 2017年 ZDQK. All rights reserved.
//

#import "DiscoverItemCell.h"

@implementation DiscoverItemCell
- (IBAction)collectionButtonAction:(id)sender {
    if (self.block) {
        self.block(self.button.selected);
    }
}

+ (CGFloat)getHeight {
    return 135;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.iconImageView.backgroundColor = [UIColor imageEDBackgroundColor];
    self.titleLabel.font = TextPingFangFontSize(14);
    self.titleLabel.textColor = [UIColor blackTextColor];
    
    self.priceLabel.font = TextPingFangFontSize(16);
    self.priceLabel.textColor = [UIColor redF2color];
    
    self.collectionLabel.font = TextPingFangFontSize(12);
    self.collectionLabel.textColor = [UIColor grayTextColor];
    
    self.button.layer.cornerRadius = 2;
    self.button.layer.borderWidth = 1;
    [self.button setTitle:@"+ 收藏" forState:UIControlStateNormal];
    [self.button setTitleColor:[UIColor redF2color] forState:UIControlStateNormal];
    [self.button setTitle:@"已收藏" forState:UIControlStateSelected];
    [self.button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
}

- (void)setButtonSelected:(BOOL)isSelect {
    [self.button setSelected:isSelect];
    if (isSelect) {
        self.button.layer.borderColor = [UIColor borderColor].CGColor;
        [self.button setBackgroundColor:[UIColor borderColor]];
    } else {
        self.button.layer.borderColor = [UIColor redF2color].CGColor;
        [self.button setBackgroundColor:[UIColor whiteColor]];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
